﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public class Emp_PunishmentModel
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _EmpBasicID;
        [DataMember]
        public int EmpBasicID
        {
            get { return _EmpBasicID; }
            set { _EmpBasicID = value; }
        }

        private string _PunishmentNo = string.Empty;
        [DataMember]
        public string PunishmentNo
        {
            get { return _PunishmentNo; }
            set { _PunishmentNo = value; }
        }

        private string _PunishmentName = string.Empty;
        [DataMember]
        public string PunishmentName
        {
            get { return _PunishmentName; }
            set { _PunishmentName = value; }
        }

        private string _PunishmentReason = string.Empty;
        [DataMember]
        public string PunishmentReason
        {
            get { return _PunishmentReason; }
            set { _PunishmentReason = value; }
        }

        private string _OkUnit = string.Empty;
        [DataMember]
        public string OkUnit
        {
            get { return _OkUnit; }
            set { _OkUnit = value; }
        }

        private DateTime? _OKDate = null;
        [DataMember]
        public DateTime? OKDate
        {
            get { return _OKDate; }
            set { _OKDate = value; }
        }

        //private string _Sec;
        //[DataMember]
        //public string Sec
        //{
        //    get { return _Sec; }
        //    set { _Sec = value; }
        //}

        //private string _WorkCharge;
        //[DataMember]
        //public string WorkCharge
        //{
        //    get { return _WorkCharge; }
        //    set { _WorkCharge = value; }
        //}

        //private string _ServiceMode;
        //[DataMember]
        //public string ServiceMode
        //{
        //    get { return _ServiceMode; }
        //    set { _ServiceMode = value; }
        //}

        //private string _IsExceptionalPromotion;
        //[DataMember]
        //public string IsExceptionalPromotion
        //{
        //    get { return _IsExceptionalPromotion; }
        //    set { _IsExceptionalPromotion = value; }
        //}

        //private string _JobStatus;
        //[DataMember]
        //public string JobStatus
        //{
        //    get { return _JobStatus; }
        //    set { _JobStatus = value; }
        //}

        //private DateTime? _JobDate;
        //[DataMember]
        //public DateTime? JobDate
        //{
        //    get { return _JobDate; }
        //    set { _JobDate = value; }
        //}
        private string _PunishmentTimeLimit = string.Empty;
        [DataMember]
        public string PunishmentTimeLimit
        {
            get { return _PunishmentTimeLimit; }
            set { _PunishmentTimeLimit = value; }
        }

        private string _EmpName = string.Empty;
        [DataMember]
        public string EmpName
        {
            get { return _EmpName; }
            set { _EmpName = value; }
        }

        private string _EmpNo = string.Empty;
        [DataMember]
        public string EmpNo
        {
            get { return _EmpNo; }
            set { _EmpNo = value; }
        }
        private string _JL = string.Empty;
        [DataMember]
        public string JL
        {
            get { return _JL; }
            set { _JL = value; }
        }   private string _SID = string.Empty;
        [DataMember]
        public string SID
        {
            get { return _SID; }
            set { _SID = value; }
        }
        private string _JCGZNX = string.Empty;
        [DataMember]
        public string JCGZNX
        {
            get { return _JCGZNX; }
            set { _JCGZNX = value; }
        }
        public static Emp_PunishmentModel FillEntity(DataRow dr)
        {
            Emp_PunishmentModel right = new Emp_PunishmentModel();
            if (!string.IsNullOrEmpty(dr["ID"].ToString()))
                right.ID = (int)dr["ID"];
            if (!string.IsNullOrEmpty(dr["EmpBasicID"].ToString()))
                right.EmpBasicID = (int)dr["EmpBasicID"];
            right.PunishmentNo = dr["PunishmentNo"] as string;
            right.PunishmentName = dr["PunishmentName"] as string;
            right.PunishmentReason = dr["PunishmentReason"] as string;
            right.OkUnit = dr["OkUnit"] as string;
            right.PunishmentTimeLimit = dr["PunishmentTimeLimit"] as string;
            right.EmpName = dr["EmpName"] as string;
            right.EmpNo = dr["EmpNo"] as string;
            //right.Sec = dr["Sec"] as string;
            //right.WorkCharge = dr["WorkCharge"] as string;
            //right.ServiceMode = dr["ServiceMode"] as string;
            //right.IsExceptionalPromotion = dr["IsExceptionalPromotion"] as string;
            //right.JobStatus = dr["JobStatus"] as string;
            right.OKDate = (string.IsNullOrEmpty(dr["OKDate"].ToString()) || dr["OKDate"].ToString() == "1900/1/1 0:00:00") ? null : (DateTime?)dr["OKDate"];
            //right.JobDate = (string.IsNullOrEmpty(dr["JobDate"].ToString()) || dr["JobDate"].ToString() == "1900/1/1 0:00:00") ? null : (DateTime?)dr["JobDate"];
            if (dr.Table != null && dr.Table.Columns.Contains("jl"))
                right.JL = dr["jl"] as string;
            right.SID = dr["SID"] as string;
            right.JCGZNX = dr["JCGZNX"] as string;
            return right;
        }
    }
}
